import {createRouter, createWebHistory} from 'vue-router'

//导入组件
import LoginVue from '@/views/decorate/Login.vue'
import HomeVue from '@/views/decorate/Home.vue'
import LayoutVue from "@/views/decorate/Layout.vue";

import CarouselVue from "@/components/Carousel.vue";

import ArticleCategoryVue from "@/views/article/ArticleCategory.vue";
import ArticleManageVue from "@/views/article/ArticleManage.vue";

import ScheduleCategoryVue from "@/views/schedule/ScheduleCategory.vue";
import ScheduleManageVue from "@/views/schedule/ScheduleManage.vue";

import UserAvatarVue from "@/views/user/UserAvatar.vue";
import UserInfoVue from "@/views/user/UserInfo.vue";
import UserResetPasswordVue from "@/views/user/UserResetPassword.vue";
import ArticleDetail from "@/views/article/ArticleDetail.vue";
import ScheduleDetail from "@/views/schedule/ScheduleDetail.vue";
import ArticleSingleDetail from "@/views/article/ArticleSingleDetail.vue";
import ArticleSentimentAnalysis from "@/views/chat/ArticleSentimentAnalysis.vue";
import ScheduleCalendar from "@/views/schedule/ScheduleCalendar.vue";

//定义路由关系
const routes = [
    {
        path: '/login', component: LoginVue
    },
    {
        path: '/', component: HomeVue, redirect: '/carousel',
        children: [
            {path: '/carousel', component: CarouselVue},
            {path: '/article/detail', component: ArticleDetail},
            {path: '/article/:id', name: 'ArticleSingle', component: ArticleSingleDetail},
            {path: '/schedule/detail', component: ScheduleDetail},
            {path: '/sentiment-analysis', component: ArticleSentimentAnalysis},
            {path: '/schedule/calendar', component: ScheduleCalendar}
        ]
    },
    {
        path: '/layout', component: LayoutVue,
        children: [
            {path: '/article/category', component: ArticleCategoryVue},
            {path: '/article/manage', component: ArticleManageVue},
            {path: '/schedule/category', component: ScheduleCategoryVue},
            {path: '/schedule/manage', component: ScheduleManageVue},
            {path: '/user/info', component: UserInfoVue},
            {path: '/user/avatar', component: UserAvatarVue},
            {path: '/user/resetPassword', component: UserResetPasswordVue}
        ]
    }
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

//导出路由
export default router